﻿//===================================================================
// 西交通开发框架-XCI.Parent 2019 版权所有     
//===================================================================
using System;
using System.ComponentModel.DataAnnotations;
using XCI.Data.Entity;

namespace XCI.Sys.Model
{
    /// <summary>
    /// 系统报表
    /// </summary>
    [Table("系统报表")]
    public class SysReport
    {
        /// <summary>
        /// 报表主键
        /// </summary>
        [Primary]
        [Column("报表主键", false)]
        public string Id { get; set; }

        /// <summary>
        /// 报表编码
        /// </summary>
        [Column("报表编码")]
        [Required(ErrorMessage = "请输入报表编码")]
        [StringLength(100, ErrorMessage = "报表编码不能超过100个字符")]
        public string Code { get; set; }

        /// <summary>
        /// 报表名称
        /// </summary>
        [Column("报表名称")]
        [Required(ErrorMessage = "请输入报表名称")]
        [StringLength(100, ErrorMessage = "报表名称不能超过100个字符")]
        public string Name { get; set; }

        /// <summary>
        /// 接口地址
        /// </summary>
        [Column("接口地址")]
        [StringLength(200, ErrorMessage = "接口地址不能超过200个字符")]
        public string Url { get; set; }

        /// <summary>
        /// 打印机
        /// </summary>
        [Column("打印机")]
        public string Printer { get; set; }

        /// <summary>
        /// 报表文件路径
        /// </summary>
        [Column("报表文件路径", false)]
        public string Path { get; set; }

        /// <summary>
        /// 报表文件本地路径
        /// </summary>
        [Column("报表文件本地路径", false)]
        public string LocalPath => ReportObject.GetLocalPath(Code);

        /// <summary>
        /// 文件指纹
        /// </summary>
        [Column("文件指纹")]
        [StringLength(100, ErrorMessage = "文件指纹不能超过100个字符")]
        public string Md5 { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [Column("备注")]
        [StringLength(500, ErrorMessage = "备注不能超过500个字符")]
        public string Remark { get; set; }

        /// <summary>
        /// 复制对象
        /// </summary>
        public SysReport Clone()
        {
            return (SysReport)MemberwiseClone();
        }
    }
}
